<?php
use common\models\business\BusinessUserNotice;
/* @var $this yii\web\View */

$this->registerCssFile('@web/statics/assets/font-awesome/css/font-awesome.css', ['depends'=>'backend\assets\AppAsset']);
$this->registerCssFile('@web/statics/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css', ['depends'=>'backend\assets\AppAsset']);
$this->registerCssFile('@web/statics/css/owl.carousel.css', ['depends'=>'backend\assets\AppAsset']);

$this->registerJsFile('@web/statics/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js', ['depends'=>'backend\assets\AppAsset']);
$this->registerJsFile('@web/statics/js/owl.carousel.js', ['depends'=>'backend\assets\AppAsset']);
$this->registerJsFile('@web/statics/js/jquery.customSelect.min.js', ['depends'=>'backend\assets\AppAsset']);
$this->registerJsFile('@web/statics/js/respond.min.js', ['depends'=>'backend\assets\AppAsset']);
$this->registerJsFile('@web/statics/js/sparkline-chart.js', ['depends'=>'backend\assets\AppAsset']);
$this->registerJsFile('@web/statics/js/easy-pie-chart.js', ['depends'=>'backend\assets\AppAsset']);
$this->registerJsFile('@web/statics/js/count.js', ['depends'=>'backend\assets\AppAsset']);

$this->registerJs("
      //owl carousel

      $(document).ready(function() {
          $(\"#owl-demo\").owlCarousel({
              navigation : true,
              slideSpeed : 300,
              paginationSpeed : 400,
              singleItem : true,
			  autoPlay:true

          });
      });

      //custom select box

      $(function(){
          $('select.styled').customSelect();
      });
");

$this->title = '牧欣农业管理平台';
?>
<section class="wrapper">
    <!--state overview start-->
    <div class="row state-overview">
        <a href="/wechat/fans/index">
        <div class="col-lg-3 col-sm-6">
            <section class="panel">
                <div class="symbol terques">
                    <i class="fa fa-user"></i>
                </div>
                <div class="value">
                    <h1 class="">
                        <?= $count['usercount']?>
                    </h1>
                    <p>用户数</p>
                </div>
            </section>
        </div>
        </a>

        <a href="/business/pig/index">
        <div class="col-lg-3 col-sm-6">
            <section class="panel">
                <div class="symbol red">
                    <i class="fa fa-tags"></i>
                </div>
                <div class="value">
                    <h1 class="">
                        <?= $count['pigcount']?>
                    </h1>
                    <p>仔猪</p>
                </div>
            </section>
        </div>
        </a>
        <a href="/shop/order/index">
        <div class="col-lg-3 col-sm-6">
            <section class="panel">
                <div class="symbol yellow">
                    <i class="fa fa-shopping-cart"></i>
                </div>
                <div class="value">
                    <h1 class="">
                        <?= $count['ordercount']?>
                    </h1>
                    <p>订单</p>
                </div>
            </section>
        </div>
        </a>
        <a href="/business/farmers/index">
        <div class="col-lg-3 col-sm-6">
            <section class="panel">
                <div class="symbol blue">
                    <i class="fa fa-bar-chart-o"></i>
                </div>
                <div class="value">
                    <h1 class="">
                        <?= $count['farmercount']?>
                    </h1>
                    <p>农户数</p>
                </div>
            </section>
        </div>
        </a>

    </div>
    <!--state overview end-->


    <div class="row state-overview">
        <a href="/business/contract/index?BusinessContractSearch[status]=2">
            <div class="col-lg-3 col-sm-6">
                <section class="panel">
                    <div class="symbol blue">
                        <i class="fa fa-bar-chart-o"></i>
                    </div>
                    <div class="value">
                        <h1 class="">
                            <?= $outcontractout?>
                        </h1>
                        <p>即将到期的合同</p>
                    </div>
                </section>
            </div>
        </a>


        <a href="/business/pig/index" target="_blank">
            <div class="col-lg-3 col-sm-6">
                <section class="panel">
                    <div class="symbol blue">
                        <i class="fa fa-bar-chart-o"></i>
                    </div>
                    <div class="value">
                        <h1 class="">
                            <?= $planoutcount?>
                        </h1>
                        <p>即将出栏的生猪</p>
                    </div>
                </section>
            </div>
        </a>

        <a href="/statistics/pig/inspection">
            <div class="col-lg-3 col-sm-6">
                <section class="panel">
                    <div class="symbol blue">
                        <i class="fa fa-bar-chart-o"></i>
                    </div>
                    <div class="value">
                        <h1 class="">
                            巡检异常
                        </h1>
                    </div>
                </section>
            </div>
        </a>

    </div>

    <div class="row">


<!--        <div class="col-lg-8">-->
<!--            <div class="border-head">-->
<!--                <h3>收益图</h3>-->
<!--            </div>-->
<!--            <div class="custom-bar-chart">-->
<!--                <ul class="y-axis">-->
<!--                    <li><span>100</span></li>-->
<!--                    <li><span>80</span></li>-->
<!--                    <li><span>60</span></li>-->
<!--                    <li><span>40</span></li>-->
<!--                    <li><span>20</span></li>-->
<!--                    <li><span>0</span></li>-->
<!--                </ul>-->
<!--                <div class="bar">-->
<!--                    <div class="title">JAN</div>-->
<!--                    <div class="value tooltips" data-original-title="80%" data-toggle="tooltip" data-placement="top">80%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">FEB</div>-->
<!--                    <div class="value tooltips" data-original-title="50%" data-toggle="tooltip" data-placement="top">50%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">MAR</div>-->
<!--                    <div class="value tooltips" data-original-title="40%" data-toggle="tooltip" data-placement="top">40%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">APR</div>-->
<!--                    <div class="value tooltips" data-original-title="55%" data-toggle="tooltip" data-placement="top">55%</div>-->
<!--                </div>-->
<!--                <div class="bar">-->
<!--                    <div class="title">MAY</div>-->
<!--                    <div class="value tooltips" data-original-title="20%" data-toggle="tooltip" data-placement="top">20%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">JUN</div>-->
<!--                    <div class="value tooltips" data-original-title="39%" data-toggle="tooltip" data-placement="top">39%</div>-->
<!--                </div>-->
<!--                <div class="bar">-->
<!--                    <div class="title">JUL</div>-->
<!--                    <div class="value tooltips" data-original-title="75%" data-toggle="tooltip" data-placement="top">75%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">AUG</div>-->
<!--                    <div class="value tooltips" data-original-title="45%" data-toggle="tooltip" data-placement="top">45%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">SEP</div>-->
<!--                    <div class="value tooltips" data-original-title="50%" data-toggle="tooltip" data-placement="top">50%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">OCT</div>-->
<!--                    <div class="value tooltips" data-original-title="42%" data-toggle="tooltip" data-placement="top">42%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">NOV</div>-->
<!--                    <div class="value tooltips" data-original-title="60%" data-toggle="tooltip" data-placement="top">60%</div>-->
<!--                </div>-->
<!--                <div class="bar ">-->
<!--                    <div class="title">DEC</div>-->
<!--                    <div class="value tooltips" data-original-title="90%" data-toggle="tooltip" data-placement="top">90%</div>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
<!--        <div class="col-lg-4">-->
<!--            <div class="panel terques-chart">-->
<!--                <div class="panel-body chart-texture">-->
<!--                    <div class="chart">-->
<!--                        <div class="heading">-->
<!--                            <span>粉丝关注统计图</span>-->
<!--                            <strong>57,00</strong>-->
<!--                        </div>-->
<!--                        <div class="sparkline" data-type="line" data-resize="true" data-height="75" data-width="90%" data-line-width="1" data-line-color="#fff" data-spot-color="#fff" data-fill-color="" data-highlight-line-color="#fff" data-spot-radius="4" data-data="[200,135,667,333,526,996,564,123,890,564,455]"></div>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->

            <!--total earning start-->
<!--            <div class="panel green-chart">-->
<!--                <div class="panel-body">-->
<!--                    <div class="chart">-->
<!--                        <div class="heading">-->
<!--                            <span>仔猪统计图</span>-->
<!--                            <strong>23</strong>-->
<!--                        </div>-->
<!--                        <div id="barchart"></div>-->
<!--                    </div>-->
<!--                </div>-->
<!--                <div class="chart-tittle">-->
<!--                    <span class="title">总计</span>-->
<!--                    <span class="value">76,54,678</span>-->
<!--                </div>-->
<!--            </div>-->
            <!--total earning end-->
        </div>
    </div>


    <div class="row">
        <div class="col-lg-12">
            <!--work progress start-->
            <section class="panel">
                <div class="panel-body progress-panel">
                    <div class="task-progress">
                        <h1>即将出栏的仔猪</h1>
                    </div>
                    <div class="task-option">
                    </div>
                </div>
                <table class="table table-hover personal-task">
                    <tbody>
                    <tr>
                        <th>
                            仔猪编号
                        </th>
                        <th>
                            巡检员
                        </th>
                        <th>
                            饲养农户
                        </th>
                        <th>
                            状态
                        </th>
                        <th>
                            出栏时间
                        </th>
                    </tr>
                    <?php foreach ($planoutpigs as $key => $row) { ?>
                        <tr>
                            <td>
                                <a href="<?= \yii\helpers\Url::to(['/business/pig/view','id'=>$row['id']]) ?>"><?= $row['no'] ?></a>
                            </td>
                            <td>
                                <span><?= $row['headperson'] ?></span>
                            </td>
                            <td>
                                <span><?= $row['liveryname'] ?></span>
                            </td>
                            <td>
                                <span class="badge bg-important">预出栏</span>
                            </td>
                            <td style="text-align: left">
                                <span class=""><?= $row['planout'] ?></span>
                            </td>
                        </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </section>
            <!--work progress end-->
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <!--work progress start-->
            <section class="panel">
                <div class="panel-body progress-panel">
                    <div class="task-progress">
                        <h1>即将到期的合同</h1>
                    </div>
                    <div class="task-option">
                    </div>
                </div>
                <table class="table table-hover personal-task">
                    <tbody>
                    <tr>
                        <th>
                            合同编号
                        </th>
                        <th>
                            合同名称
                        </th>
                        <th>
                            甲方
                        </th>
                        <th>
                            乙方
                        </th>
                        <th>
                            签订时间
                        </th>
                        <th>
                            到期时间
                        </th>
                        <th>
                            状态
                        </th>
                    </tr>
                    <?php foreach ($outcontract as $key => $row) { ?>
                        <tr>
                            <td>
                                <a href="<?= \yii\helpers\Url::to(['/business/contract/view','id'=>$row['id']]) ?>"><?= $row['no'] ?></a>
                            </td>
                            <td>
                                <span><?= $row['name'] ?></span>
                            </td>
                            <td>
                                <span><?= $row['partyA'] ?></span>
                            </td>
                            <td>
                                <span><?= $row['partyB'] ?></span>
                            </td>
                            <td>
                                <span><?= date('Y-m-d',$row['start_time']) ?></span>
                            </td>
                            <td>
                                <span><?= date('Y-m-d',$row['end_time']) ?></span>
                            </td>
                            <td style="text-align: left">
                                <span class="badge bg-warning">距过期还有<?= \common\components\Helper::dateDifference(date('Y-m-d',$row['end_time']),date('Y-m-d')) ?>天</span>
                            </td>

                        </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </section>
            <!--work progress end-->
        </div>
    </div>


    <div class="row">
        <div class="col-lg-12">
            <!--work progress start-->
            <section class="panel">
                <div class="panel-body progress-panel">
                    <div class="task-progress">
                        <h1>消息提示</h1>
                    </div>
                    <div class="task-option">
                    </div>
                </div>
                <table class="table table-hover personal-task">
                    <tbody>
                    <?php foreach ($msg as $key => $row) { ?>
                    <tr>
                        <td>1</td>
                        <td>
                            <a href="<?= \yii\helpers\Url::to(['/business/user-notice/msg-view','id'=>$row['id']]) ?>"><?= $row['title'] ?></a>
                        </td>
                        <td>
                            <span class="badge bg-<?= BusinessUserNotice::renderLevel($row['level']) ?>"> <?= BusinessUserNotice::$levels[$row['level']] ?></span>
                        </td>
                        <td>
                            <div id="work"><?= $row['time'] ?></div>
                        </td>
                    </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </section>
            <!--work progress end-->
        </div>
    </div>

</section>

<script>
    <?php $this->beginBlock('js_end')?>

    //统计数据


    <?php $this->endBlock() ?>
    <?php $this->registerJs($this->blocks['js_end'],\yii\web\View::POS_END) ?>



</script>